<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutOther.xhtml">
	<ui:define name="title">#{msg.titleOther}</ui:define>
		<ui:define name="content">
			<h:form>
				<h2>#{msg.searchTrip}</h2>
				<h:panelGrid columns="4">
		     		<h:outputLabel value="#{msg.origin}"/>
		     		<p:selectOneMenu id="origin" value="#{searchTripMB.tripFilter.origin}">
		     			<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
	                	<f:selectItems value="#{searchTripMB.places}" />   
	            	</p:selectOneMenu> 
	            	
	            	<h:outputLabel value="#{msg.destiny}"/>
		     		<p:selectOneMenu id="destiny" value="#{searchTripMB.tripFilter.destiny}">
		     			<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
	                	<f:selectItems value="#{searchTripMB.places}" />   
	            	</p:selectOneMenu> 

				</h:panelGrid>
				<h:panelGrid columns="2" style="margin-top:10px; text-align:center">
	     			<r:commandLinkCustom id="reset" action="#{searchTripMB}" method="reset" icon="icon-eraser" message="#{msg.resetButton}"/>
     				<r:commandLinkCustom id="search" action="#{searchTripMB}" method="search" icon="icon-search" message="#{msg.searchButton}"/>
	     	 	</h:panelGrid>
	     	 
	     	 	<p:blockUI block="tripTable" trigger="tripTable">  
			        #{msg.loading}<br />  
			        <p:graphicImage value="/images/ajax-loader.gif"/>  
			    </p:blockUI>  
	     	 	
	     	 	<p:dataTable var="trip" value="#{searchTripMB.tripLazyDataModel}"  id="tripTable"
	     	 		style="padding-top:15px" paginator="true" lazy="true"
	     	 		rows="10"
	     	 		paginatorPosition="bottom" emptyMessage="#{msg.noRecordsFound}">

	 		 		<p:column headerText="#{msg.origin}" style="width:15%">  
		            	<h:outputText value="#{searchTripMB.obtainDescription(trip.placeOrigin.description)}" />   
	        		</p:column> 
	        				 
	 		 		<p:column headerText="#{msg.destiny}" style="width:15%">  
		            	<h:outputText value="#{searchTripMB.obtainDescription(trip.placeDestiny.description)}" />   
	        		</p:column> 
	 
	 				<p:column headerText="#{msg.totalKm}" style="width:7%" >  
		            	<h:outputText value="#{trip.totalKM}" />   
	        		</p:column> 
	        		
			        <p:column headerText="#{msg.cancelationTime}" style="width:7%">  
		            	<h:outputText value="#{searchTripMB.formatTime(trip.time)}" />   
	        		</p:column> 
	        		
	        		<p:column headerText="#{msg.actions}" style="width:7%">
	        			<center>
	        				<h:commandLink action="#{searchTripMB.viewTrip(trip)}" ajax="false" process="@form">
	        					<i class="icon-zoom-in icon-2x color-zoom"></i>
	        				</h:commandLink>
	        			</center>
	        		</p:column>	        		
	        	</p:dataTable>
			
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
